package com.gulimall.coupon.controller;

import com.gulimall.common.core.domain.Result;
import com.gulimall.coupon.domain.entity.Coupon;
import com.gulimall.coupon.service.ICouponService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test/coupon")
public class TestController {
    @Resource
    private ICouponService couponService;

    /**
     * 保存单个优惠券到数据库
     */
    @PostMapping("/save")
    public Result saveCoupon(){
        Coupon coupon = new Coupon();
        coupon.setCouponName("瑞星咖啡买一送一");
        couponService.save(coupon);
        return Result.ok();
    }
}
